{% extends "blog/blog_post_list.html" %}
{% load mezzanine_tags comment_tags keyword_tags rating_tags i18n future disqus_tags %}

{% block meta_title %}{{ blog_post.meta_title }}{% endblock %}

{% block meta_keywords %}{% metablock %}
{% keywords_for blog_post as tags %}
{% for tag in tags %}{% if not forloop.first %}, {% endif %}{{ tag }}{% endfor %}
{% endmetablock %}{% endblock %}

{% block meta_description %}{% metablock %}
{{ blog_post.description }}
{% endmetablock %}{% endblock %}

{% block title %}
{% editable blog_post.title %}{{ blog_post.title }}{% endeditable %}
{% endblock %}

{% block breadcrumb_menu %}
<ul class="breadcrumb">
{{ block.super }}
<li class="active">{{ blog_post.title }}</li>
</ul>
{% endblock %}

{% block main %}

<div class="sidemeta">
    <div class="post {% if settings.BLOG_USE_FEATURED_IMAGE and blog_post.featured_image %}format-image{% else %}format-standard{% endif %}">

        <div class="date-wrapper">
            <div class="date">
                <span class="day">{{ blog_post.publish_date|date:"d" }}</span>
                <span class="month">{{ blog_post.publish_date|date:"M" }}</span>
            </div><!-- /.date -->
        </div><!-- /.date-wrapper -->

        <!--<div class="format-wrapper">
            <a href="#" data-filter=".format-image"><i class="icon-picture-1"></i></a>
        </div>-->
        
        <div class="post-content">

            {% if settings.BLOG_USE_FEATURED_IMAGE and blog_post.featured_image %}
            {% block blog_post_list_post_featured_image %}
            <figure class="icon-overlay icn-link post-media" style="max-height: none;">
                <a href="{{ blog_post.get_absolute_url }}">
                    <img src="{{ MEDIA_URL }}{% thumbnail blog_post.featured_image 90 90 %}">
                </a>
            </figure><!-- /.post-media -->
            {% endblock %}
            {% endif %}

            {% block blog_post_list_post_title %}
            <h2 class="post-title">
                <a href="{{ blog_post.get_absolute_url }}">{{ blog_post.title }}</a>
            </h2>
            <!--{% editable blog_post.title %}
            {% endeditable %}-->
            {% endblock %}


            {% block blog_post_list_post_metainfo %}
            <!--{% editable blog_post.publish_date %}
            {% endeditable %}-->
            <div class="meta">
                {% with blog_post.user as author %}
                <i class="icon-user"></i>
                <a href="{% url 'blog_post_list_author' author %}">{{ author.get_full_name|default:author.username }}</a> |
                {% endwith %}
                {% with blog_post.categories.all as categories %}
                {% if categories %}
                <i class="icon-folder"></i>
                {% for category in categories %}                
                <a href="{% url 'blog_post_list_category' category.slug %}">{{ category }}</a>{% if not forloop.last %}, {% endif %}
                {% endfor %}
                |
                {% endif %}
                {% endwith %}
                {% if blog_post.allow_comments %}
                <i class="icon-comment"></i>
                {% if settings.COMMENTS_DISQUS_SHORTNAME %}
                <a href="{{ blog_post.get_absolute_url }}#disqus_thread"
                   data-disqus-identifier="{% disqus_id_for blog_post %}">
                    {% trans "Comments" %}
                </a>
                {% else %}
                <a href="{{ blog_post.get_absolute_url }}#comments">
                    {% blocktrans count comments_count=blog_post.comments_count %}{{ comments_count }} comment{% plural %}{{ comments_count }} comments{% endblocktrans %}
                </a>
                {% endif %}
                {% endif %}

            </div>

            {% endblock %}

            {% block blog_post_list_post_content %}
            <!--{% editable blog_post.content %}
            {% endeditable %}-->
            <p>{{ blog_post.content|richtext_filters|safe }}</p>

            {% endblock %}

            {% if settings.COMMENTS_DISQUS_SHORTNAME %}
            {% include "generic/includes/disqus_counts.html" %}
            {% endif %}



            {% block blog_post_detail_keywords %}
            {% keywords_for blog_post as tags %}
            {% if tags %}
            {% spaceless %}
            <ul class="list-inline tags" style="font-size: small;">
                <li>{% trans "Tags" %}:</li>
                {% for tag in tags %}
                <li><a href="{% url 'blog_post_list_tag' tag.slug %}">{{ tag }}</a></li>
                {% endfor %}
            </ul>
            {% endspaceless %}
            {% endif %}
            {% endblock %}

            <!--{% block blog_post_detail_rating %}
            <div class="panel panel-default rating">
                <div class="panel-body">
                    {% rating_for blog_post %}
                </div>
            </div>
            {% endblock %}-->


        </div>
    </div>
</div>


{% block blog_post_detail_sharebuttons %}
    {% set_short_url_for blog_post %}
    <a class="btn btn-sm share-twitter" target="_blank" href="http://twitter.com/home?status={{ blog_post.short_url|urlencode }}%20{{ blog_post.title|urlencode }}">{% trans "Share on Twitter" %}</a>
    <a class="btn btn-sm share-facebook" target="_blank" href="http://facebook.com/sharer.php?u={{ request.build_absolute_uri }}&amp;t={{ blog_post.title|urlencode }}">{% trans "Share on Facebook" %}</a>
{% endblock %}

{% block blog_post_previous_next %}
<ul class="pager">
{% with blog_post.get_previous_by_publish_date as previous %}
{% if previous %}
<li class="previous">
    <a href="{{ previous.get_absolute_url }}">&larr; {{ previous }}</a>
</li>
{% endif %}
{% endwith %}
{% with blog_post.get_next_by_publish_date as next %}
{% if next %}
<li class="next">
    <a href="{{ next.get_absolute_url }}">{{ next }} &rarr;</a>
</li>
{% endif %}
{% endwith %}
</ul>
{% endblock %}

{% block blog_post_detail_related_posts %}
{% if blog_post.related_posts.all %}
<div id="related-posts">
<h3>{% trans 'Related posts' %}</h3>
<ul class="list-unstyled">
{% for post in blog_post.related_posts.all %}
     <li><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endblock %}

{% block blog_post_detail_comments %}
{% if blog_post.allow_comments %}{% comments_for blog_post %}{% endif %}
{% endblock %}

{% endblock %}
